<html>
    <head>
        <script>
            function Fan(){
                var str1=document.getElementById("what").value;
                var str2="";
                for(var i=str1.length;i>=0;i--){
                    str2+=str1[i];
                }
                alert(str2);
            }
        </script>
    </head>
    <body>
        请输入一个字符串<input type="text" id="what"/>
        <input type="button" value="输出" onclick="Fan()"/> 
     </body>
</html>